<#import "/macro.ftl" as m>
<@m.page_header title='渠道分析' />
<div id="page-content-wrapper">
    <div id="page-title">
        <h3>${channelAnalyse.name}渠道分析</h3>
    </div>
    <div id="page-content">
    	<form action="/channels/analyse" method="get" class="mrg20B">
    		<input type="hidden" name="biggerCategoryId" value="${biggerCategoryId}" />
    		<input type="hidden" name="categoryId" value="${categoryId}" />
    		<input type="hidden" name="popularizeId" value="${popularizeId}" />
    		<input type="hidden" name="number" value="${number}" />
	    	<div class="row">
	    		<div class="form-input col-md-2">
	    			<input id="startDate" name="startDate" value="${startDate?string('yyyy-MM-dd')}" placeholder="统计时间从" type="text"
	    			onclick="WdatePicker({isShowWeek:true,dateFmt:'yyyy-MM-dd'})">
	    		</div>
	    		<div class="form-input col-md-2">
	    			<input id="endDate" name="endDate" value="${endDate?string('yyyy-MM-dd')}" placeholder="统计时间到" type="text"
	    			onclick="WdatePicker({isShowWeek:true,dateFmt:'yyyy-MM-dd'})">
	    		</div>
	    		<div class="form-input col-md-6">
	    			<a href="javascript:;" class="btn large primary-bg radius-all-4" id="search" onclick="submit( false );">
			            <span class="button-content">查询</span>
	                </a>
	                <a href="javascript:;" class="btn large primary-bg radius-all-4" id="search" onclick="submit( true );">
			            <span class="button-content">全部</span>
	                </a>
	                <a href="javascript:;" class="btn large primary-bg radius-all-4" id="search" onclick="exportAnalyse();">
			            <span class="button-content">导出Excel</span>
	                </a>
	                <a href="javascript:;" class="btn large primary-bg radius-all-4" id="search" onclick="exportDailyAnalyse();">
			            <span class="button-content">导出日明细</span>
	                </a>
	    		</div>
	    	</div>
    	</form>
    	<div class="row">
    		<div class="form-label col-md-2">
    			<label title="统计时间范围内的跟踪渠道的访问数">访问IP数：</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label>${channelAnalyse.visitCount}</label>
    		</div>
    	</div>
    	<div class="row">
    		<div class="form-label col-md-2">
    			<label title="统计时间范围内的注册用户数">注册用户数：</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label>${channelAnalyse.registerCount}</label>
    		</div>
    	</div>
    	<div class="row">
    		<div class="form-label col-md-2">
    			<label title="统计时间范围内用户注册并交易的用户数（包含失败交易）">注册交易用户数：</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label>${channelAnalyse.registerTradeUserCount}</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label title="统计时间范围内用户注册并交易的订单数（包含失败交易）">注册交易订单数：</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label>${channelAnalyse.registerUserOrderCount}</label>
    		</div>
    		<div class="form-label col-md-2">
    		</div>
    		<div class="form-label col-md-2">
    		</div>
    	</div>
    	<div class="row">
    		<div class="form-label col-md-2">
    			<label title="统计时间范围内用户注册并成功交易的用户数">注册成功交易用户数：</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label>${channelAnalyse.registerPaidUserCount}</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label title="统计时间范围内用户注册并成功交易的订单数">注册成功交易订单数：</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label>${channelAnalyse.registerUserPaidOrderCount}</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label title="统计时间范围内用户注册并成功交易的订单金额">注册成功交易金额：</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label>${channelAnalyse.registerUserPaymentAmount?string(',##0.00')}元</label>
    		</div>
    	</div>
    	<div class="row">
    		<div class="form-label col-md-2">
    			<label title="统计时间范围内实名认证的用户数">实名认证数：</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label>${channelAnalyse.realNameCount}</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label title="统计时间范围内的交易订单数（包含失败订单）">交易订单数：</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label>${channelAnalyse.orderCount}</label>
    		</div>
    	</div>
    	<div class="row">
    		<div class="form-label col-md-2">
    			<label title="统计时间范围内成功交易的用户数">成功交易用户数：</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label>${channelAnalyse.paidUserCount}</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label title="统计时间范围内成功交易的订单数">成功交易订单数：</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label>${channelAnalyse.paidOrderCount}</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label title="统计时间范围内成功交易的订单金额">成功交易金额：</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label>${channelAnalyse.paymentAmount?string(',##0.00')}元</label>
    		</div>
    	</div>
    	<div class="row">
    		<div class="form-label col-md-2">
    			<label title="统计时间范围内新增成功交易的用户数">新增交易用户数：</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label>${channelAnalyse.newTradeUserCount}</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label title=""></label>
    		</div>
    		<div class="form-label col-md-2">
    		</div>
    		<div class="form-label col-md-2">
    			<label title="统计时间范围内新增成功交易的订单金额">新增交易金额：</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label>${channelAnalyse.newTradeOrderAmount?string(',##0.00')}元</label>
    		</div>
    	</div>
    	<div class="row">
    		<div class="form-label col-md-2">
    			<label title="统计时间范围内成功复投的用户数">复投用户数：</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label>${channelAnalyse.repeatOrderUserCount}</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label title="统计时间范围内成功复投的订单数">复投订单数：</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label>${channelAnalyse.repeatOrderCount}</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label title="统计时间范围内成功复投的订单金额">复投订单金额：</label>
    		</div>
    		<div class="form-label col-md-2">
    			<label>${channelAnalyse.repeatOrderAmount?string(',##0.00')}元</label>
    		</div>
    	</div>
    </div>
</div>
<script>

// 提交
// all 是否查询全部
function submit( all ){
	
	if (all) {
		$('#startDate').val('2014-01-01');
		$('#endDate').val(new Date().Format("yyyy-MM-dd"));
	}

	var valid = $('form').parsley( 'validate' );
	if(!valid){
		return;
	}
	$('form').submit();
}

// 导出数据
function exportAnalyse(){
	var form = $('form').clone();
	form.attr('action', form.attr('action') + '.xlsx');
	form.submit();
}

// 导出日明细
function exportDailyAnalyse(){
	var form = $('form').clone();
	form.attr('action', '/channels/dailyanalyse.xlsx');
	form.submit();
}

</script>